package com.office.framework.common;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;

/**
 * Created by jyyco on 2015/7/23.
 */
public abstract class BaseController extends Controller {

//    private  String SENDLIST;
//    public void list(){
//
//        render(this.getClass().getSimpleName()+"/list.html");
//    }


    private Model daoManger;
    private Integer limit;
    private Integer start;
    public Model getDaoManger() {
        return daoManger;
    }
    public abstract void setDaoManger(Model daoManger);


    public void  doPageEntity(){
        if(this.limit == 0) {
            this.limit = 20;
        }

        if(this.start < 1) {
            this.start = 1;
        }

        Page page = this.getEntityManager().pagedQuery(modelSetup, this.start, this.limit);
        this.setEntitys(page.getResult());
        this.setTotalCount(page.getTotalCount());
    }


}
